/*
ID: guoxu1
PROG: namenum
LANG: C++
*/
#include <iostream>
#include <fstream>
#include <vector>
#include <map>
#include <algorithm>
#include <string>
#include <cstring>
using namespace std;

#define cin fin
#define cout fout

const long long N[] = { 2,2,2,3,3,3,4,4,4,5,5,5,6,6,6,7,0,7,7,8,8,8,9,9,9,0 };

int main()
{
	typedef multimap<long long,string> _mmap;
	typedef _mmap::iterator _mit;
	typedef pair<_mit,_mit> _mpii;
	_mmap dict;

	ifstream fdict( "dict.txt" );
	ifstream fin( "namenum.in" );
	ofstream fout( "namenum.out" );
	
	string s;
	while( getline( fdict, s ) )
	{
		long long k = 0;
		for( string::const_iterator it = s.begin(); it != s.end(); it++ )
		{
			if( *it == 'Q' || *it == 'Z' )
			{
				k = 0;
				break;
			}
			k = k * 10 + N[*it - 'A'];
		}
		if( k != 0 )
		{
			dict.insert( make_pair( k, s ) );
		}
	}

	long long n = 0;
	cin >> n;
	_mpii it = dict.equal_range( n );
	if( it.first == it.second )
	{
		cout << "NONE" << endl;
	}
	else
	{
		for( _mit i = it.first;
			i != it.second; i++ )
		{
			cout << i->second << endl;
		}
	}

	return 0;
}
